<?php /*a:1:{s:87:"D:\developers\project\web_fpy\web_fpy\main\application\admin\view\house\house_list.html";i:1600830066;}*/ ?>
<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <link rel="stylesheet" href="/static/css/pagination.css"/>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">演示</a>
                <a>
                    <cite>导航元素</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="url_to()" title="刷新" id="refresh">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <div class="layui-collapse" lay-filter="test">
                        <div class="layui-colla-item">
                            <h2 class="layui-colla-title">筛选条件<i class="layui-icon layui-colla-icon"></i></h2>
                            <div class="layui-colla-content">

                                <form class="layui-form">

                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">房源标题</label>
                                            <div class="layui-input-inline layui-show-xs-block">
                                                <input type="text" name="h_title" placeholder="房源标题" id="h_title"
                                                       autocomplete="off" value=""
                                                       class="layui-input"></div>
                                        </div>
                                    </div>

                                    <div class="layui-form-item x-city" id="x-city">
                                        <label class="layui-form-label">城市</label>
                                        <div class="layui-input-inline">
                                            <select name="city_code" lay-search="" id="city_code">
                                                <?php foreach($city_list as $city_list_k=>$city_list_v): ?>
                                                <option value="<?php echo htmlentities($city_list_v['city_code']); ?>" <?php if($city_list_v['city_code']==510100){ ?> selected<?php } ?>><?php echo htmlentities($city_list_v['name']); ?>
                                                </option>
                                                <?php endforeach; ?>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">价格</label>
                                            <div class="layui-input-inline" style="width: 100px;">
                                                <input type="text" name="price_min" placeholder="万" autocomplete="off"
                                                       id="price_min"
                                                       class="layui-input">
                                            </div>
                                            <div class="layui-form-mid">-</div>
                                            <div class="layui-input-inline" style="width: 100px;">
                                                <input type="text" name="price_max" placeholder="万" autocomplete="off"
                                                       id="price_max"
                                                       class="layui-input">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">面积</label>
                                            <div class="layui-input-inline" style="width: 100px;">
                                                <input type="text" name="area_min" placeholder="㎡" autocomplete="off"
                                                       class="layui-input" id="area_min">
                                            </div>
                                            <div class="layui-form-mid">-</div>
                                            <div class="layui-input-inline" style="width: 100px;">
                                                <input type="text" name="area_max" placeholder="㎡" autocomplete="off"
                                                       class="layui-input" id="area_max">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">折扣比</label>
                                            <div class="layui-input-inline" style="width: 100px;">
                                                <input type="text" name="discount_min" placeholder="折"
                                                       autocomplete="off"
                                                       class="layui-input" id="discount_min">
                                            </div>
                                            <div class="layui-form-mid">-</div>
                                            <div class="layui-input-inline" style="width: 100px;">
                                                <input type="text" name="discount_max" placeholder="折"
                                                       autocomplete="off"
                                                       class="layui-input" id="discount_max">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div class="layui-inline">
                                            <label class="layui-form-label">拍卖阶段</label>
                                            <div class="layui-input-inline">
                                                <select name="a_type" id="a_type">
                                                    <option value="">请选择</option>
                                                    <option value="1">第一次拍卖</option>
                                                    <option value="2">第二次拍卖</option>
                                                    <option value="3">第三次拍卖</option>
                                                    <option value="4">变卖</option>
                                                    <option value="5">重新拍卖</option>
                                                    <option value="6">破产</option>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="layui-inline">
                                            <label class="layui-form-label">拍卖状态</label>
                                            <div class="layui-input-inline">
                                                <select name="a_status" id="a_status">
                                                    <option value="">请选择</option>
                                                    <option value="1">待开始</option>
                                                    <option value="2">进行中</option>
                                                    <option value="3">已成交</option>
                                                    <option value="4">已流拍</option>
                                                    <option value="5">已撤回</option>
                                                    <option value="6">已终止</option>
                                                    <option value="7">已暂缓</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="layui-form-item x-city">
                                        <label class="layui-form-label">户型</label>
                                        <div class="layui-input-inline">
                                            <select name="bed_room" id="bed_room">
                                                <option value="">请选择</option>
                                                <option value="1">一居室</option>
                                                <option value="2">二居室</option>
                                                <option value="3">三居室</option>
                                                <option value="4">四居室</option>
                                                <option value="5">五居室以上</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="layui-form-item x-city">
                                        <label class="layui-form-label">楼梯</label>
                                        <div class="layui-input-inline">
                                            <select name="lifts" id="lifts">
                                                <option value="">请选择</option>
                                                <option value="1">电梯</option>
                                                <option value="2">楼梯</option>
                                                <option value="3">未知</option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="layui-form-item">
                                        <div class="layui-input-block">
                                            <button class="layui-btn" type="button" lay-filter="demo1" id="searchBtn">
                                                立即提交
                                            </button>
                                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                        </div>
                                    </div>
                                </form>

                            </div>
                        </div>
                    </div>
                </div>

                <!--                原型-->
                <div class="content999">
                    <div class="layui-card-body" style="overflow:auto;width:100%">
                        <table class="layui-table layui-form " width="auto" style="white-space:nowrap" >
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>操作</th>
                                <th>封面</th>
                                <th>状态</th>
                                <th>房源标题</th>
                                <th>小区名</th>
                                <th>区域</th>
                                <th>产权类型</th>
                                <th>面积</th>
                                <th>装修类型</th>
                                <th>户型</th>
                                <th>建筑年代</th>
                                <th>楼层</th>
                                <th>楼梯</th>
                                <th>法院</th>
                                <th>起拍价（万）</th>
                                <th>市场价（万）</th>
                                <th>拍卖阶段</th>
                                <th>拍卖状态</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach($data as $k=>$v): ?>
                            <tr>
                                <td><?php echo htmlentities($v['id']); ?></td>
                                <td class="td-manage">
                                    <a title="查看" class="seeinfo" data-id="<?php echo htmlentities($v['id']); ?>" onclick="return false"
                                       href="javascript:;">
                                        <i class="layui-icon">&#xe63c;</i></a>
                                    <a title="编辑" class="editinfo" data-id="<?php echo htmlentities($v['id']); ?>" onclick="return false"
                                       href="javascript:;">
                                        <i class="layui-icon">&#xe642;</i>
                                    </a>
                                    <a title="删除" onclick="member_del(this,<?php echo htmlentities($v['id']); ?>)" href="javascript:;">
                                        <i class="layui-icon">&#xe640;</i>
                                    </a>
                                </td>
                                <td><img src="<?php echo htmlentities($v['cover']); ?>" alt="" style="width: 50px;height: 50px;"></td>
                                <td>
                                    <button class="layui-btn layui-btn-primary edit_is_shelf" data-id="<?php echo htmlentities($v['id']); ?>"
                                            data-shelf="<?php echo htmlentities($v['is_shelf']); ?>">
                                        <?php echo htmlentities($v['is_shelf']); ?>
                                    </button>
                                </td>
                                <td><?php echo htmlentities($v['title']); ?></td>
                                <td><?php echo htmlentities($v['hv_name']); ?></td>
                                <td><?php echo htmlentities($v['area']); ?></td>
                                <td><?php echo htmlentities($v['property_type']); ?></td>
                                <td><?php echo htmlentities($v['build_area']); ?></td>
                                <td><?php echo htmlentities($v['renovation_type']); ?></td>
                                <td><?php echo htmlentities($v['bedroom']); ?></td>
                                <td><?php echo htmlentities($v['build_time']); ?></td>
                                <td><?php echo htmlentities($v['floor']); ?></td>
                                <td><?php echo htmlentities($v['lifts']); ?></td>
                                <td><?php echo htmlentities($v['court_name']); ?></td>
                                <td><?php echo htmlentities($v['initial_price']); ?></td>
                                <td><?php echo htmlentities($v['market_price']); ?></td>
                                <td><?php echo htmlentities($v['type']); ?></td>
                                <td><?php echo htmlentities($v['auction_status']); ?></td>
                            </tr>
                            <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                </div>


                <script type="text/html" id="mainproducts">
                    <div class="layui-card-body" style="overflow:auto;width:100%">
                        <table class="layui-table layui-form " width="auto" style="white-space:nowrap">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>操作</th>
                                <th>封面</th>
                                <th>状态</th>
                                <th>房源标题</th>
                                <th>小区名</th>
                                <th>区域</th>
                                <th>产权类型</th>
                                <th>面积</th>
                                <th>装修类型</th>
                                <th>户型</th>
                                <th>建筑年代</th>
                                <th>楼层</th>
                                <th>楼梯</th>
                                <th>法院</th>
                                <th>起拍价（万）</th>
                                <th>市场价（万）</th>
                                <th>拍卖阶段</th>
                                <th>拍卖状态</th>
                            </tr>
                            </thead>
                            <tbody>
                            {{each data as value i1}}
                            <tr>
                                <td>{{value.id}}</td>
                                <td class="td-manage">
                                    <a title="查看" class="seeinfo" data-id="{{value.id}}" onclick="return false"
                                       href="javascript:;">
                                        <i class="layui-icon">&#xe63c;</i></a>
                                    <a title="编辑" class="editinfo" data-id="{{value.id}}" onclick="return false"
                                       href="javascript:;">
                                        <i class="layui-icon">&#xe642;</i>
                                    </a>
                                    <a title="删除" onclick="member_del(this,{{value.id}})" href="javascript:;">
                                        <i class="layui-icon">&#xe640;</i>
                                    </a>
                                </td>
                                <td><img src="{{value.cover}}" alt="" style="width: 50px;height: 50px;"></td>
                                <td>
                                    <button class="layui-btn layui-btn-primary edit_is_shelf" data-id="{{value.id}}"
                                            data-shelf="{{value.is_shelf}}">
                                        {{value.is_shelf}}
                                    </button>
                                </td>
                                <td>{{value.title}}</td>
                                <td>{{value.hv_name}}</td>
                                <td>{{value.area}}</td>
                                <td>{{value.property_type}}</td>
                                <td>{{value.build_area}}</td>
                                <td>{{value.renovation_type}}</td>
                                <td>{{value.bedroom}}</td>
                                <td>{{value.build_time}}</td>
                                <td>{{value.floor}}</td>
                                <td>{{value.lifts}}</td>
                                <td>{{value.court_name}}</td>
                                <td>{{value.initial_price}}</td>
                                <td>{{value.market_price}}</td>
                                <td>{{value.type}}</td>
                                <td>{{value.auction_status}}</td>
                            </tr>
                            {{/each}}
                            </tbody>
                        </table>
                    </div>
                </script>

                <div class="box" id="wrap1"></div>
                <input type="hidden" id="count" value="<?php echo htmlentities($count); ?>">
            </div>
        </div>
    </div>
</div>
</body>

<script src="/static/js/pagination.js"></script>
<script src="/static/js/arttemplate.js"></script>
<script type="text/javascript">
    sessionStorage.page=1
    var num = $('#count').val()
    //分页
    var onPagechange = function (page) {
        var h_title = $('#h_title').val();
        var city_code = $('#city_code option:selected').val();
        var price_min = $('#price_min').val();
        var price_max = $('#price_max').val();
        var area_min = $('#area_min').val();
        var area_max = $('#area_max').val();
        var discount_min = $(discount_min).val();
        var discount_max = $('#discount_max').val();
        var a_type = $('#a_type option:selected').val();
        var a_status = $('#a_status option:selected').val();
        var bed_room = $('#bed_room option:selected').val();
        var lifts = $('#lifts option:selected').val();
        $.ajax({
            type: 'POST',
            url: '',
            data: {
                page: page,
                h_title: h_title,
                city_code: city_code,
                price_min: price_min,
                price_max: price_max,
                area_min: area_min,
                area_max: area_max,
                discount_min: discount_min,
                discount_max: discount_max,
                a_type: a_type,
                a_status: a_status,
                bed_room: bed_room,
                lifts: lifts,
            },
            dataType: "json",
            timeout: 2000,
            success: function (res) {
                var content = $('.content999')
                content.html('')
                var html = template('mainproducts', res);
                content.append(html);
            },
        });
        sessionStorage.page=page
    }

    //分页初始化
    var obj = {
        wrapid: 'wrap1', //页面显示分页器容器id
        total: num,//总条数
        pagesize: 10,//每页显示10条
        currentPage: 1,//当前页
        onPagechange: onPagechange,
    }

    pagination.init(obj);

    var content999 = $('.content999 ')

    //详情
    content999.on('click', '.seeinfo', function () {
        var me = $(this);
        var id = me.data('id')
        xadmin.open('查看', '<?php echo url('House/houseInfo'); ?>?id=' + id)
    })

    //编辑
    content999.on('click', '.editinfo', function () {
        var me = $(this);
        var id = me.data('id')
        xadmin.open('编辑', '<?php echo url('House/edit'); ?>?id=' + id, 500, 600)
    })

    //搜索
    $('#searchBtn').click(function () {
        var formData = $('form').serialize()
        $.post('', formData, function (resp) {
            var obj = {
                wrapid: 'wrap1', //页面显示分页器容器id
                total: resp.count,//总条数
                pagesize: 10,//每页显示10条
                currentPage: 1,//当前页
                onPagechange: onPagechange,
            }
            pagination.init(obj);
            var content = $('.content999')
            content.html('')
            var html = template('mainproducts', resp);
            content.append(html);
        }, 'json');
    })

    //上下架
    content999.on('click', '.edit_is_shelf', function () {
        var me = $(this);
        var id = me.data('id')
        var shelf = me.data('shelf')
        layer.confirm('确认要' + shelf + '吗？', function () {
            $.post('<?php echo url("House/edit_is_shelf"); ?>', {id: id}, function (resp) {
                if (shelf == '下架') {
                    me.text('上架')
                } else {
                    me.text('下架')
                }
                if (resp.code == 200) {
                    layer.msg('操作成功!', {icon: 1, time: 1000});
                }
            }, 'json');
        });
    })

    //删除
    function member_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.post('<?php echo url("House/del"); ?>', {id: id}, function (resp) {
                if (resp.code == 200) {
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!', {icon: 1, time: 1000});
                }
            }, 'json');
        });
    }

    //自定义刷新
    function url_to() {
        var page = sessionStorage.page
        $.ajax({
            type: 'POST',
            url: '',
            data: {
                page: page,
            },
            dataType: "json",
            timeout: 2000,
            success: function (res) {
                var content = $('.content999')
                content.html('')
                var html = template('mainproducts', res);
                content.append(html);
            },
        });
    }
</script>


<script>layui.use(['laydate', 'form'],
    function () {
        var laydate = layui.laydate;

        //日期范围
        laydate.render({
            elem: '#test6'
            , range: true
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

</script>

</html>
